
const p=new Promise((a,b)=>{
    setTimeout(()=>{
        a(1);
        b(new Error('message'))
    },2000)
});


p
    .then(x=>console.log(x))
    .then(x=>console.log(x))
    .catch(error=>console.log('error', error.message));